<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>检漏</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/layui.css"  media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/toastr.min.css"  media="all">
	<style type="text/css">
		.layui-form-item {
			display: inline-block;
			width: 30%;
		}
		#addFormId .layui-form-label{
			padding: 9px 15px 9px 0 !important;
			width:auto !important;
			display: inline-block;
		}
		/* .layui-table-cell {
			overflow:visible;
		} */
		thead .layui-table-cell{
		   	height:auto;
		  	overflow:visible;
		  	text-overflow:inherit;
		 	white-space:normal;
		 	text-align: center;
		}
		#details form .layui-input {
			border-top:none;
			border-left:none;
			border-right:none;
			border-bottom:1px solid #AAA !important;
			background-color: rgb(242,242,242);
			border-radius:0;
		}
		#tr input{
			width:90%;
		}
	</style>
</head>
<body>
<!-- 隐藏tab -->
<form class="layui-form layui-card-body" id="addFormId" hidden>
	<table class="layui-table" id="tab">
		<thead>
			<tr>
				<th>组件条码</th>
				<th>B面堵漏个数：大</th>
				<th>B面堵漏个数：小</th>
				<th>B面堵漏总数</th>
				<th>A面堵漏个数：大</th>
				<th>A面堵漏个数：小</th>
				<th>A面堵漏个数：总数</th>
				<th>端面补胶</th>
			</tr>
		</thead>
		<tbody id="tbody">
    			<tr id="tr">
					<td><input class="layui-input" readonly id="codex" name="code"/></td>
					<td><input class="layui-input" readonly id="bDlNumBigx" name="bDlNumBig"/></td>
					<td><input class="layui-input" readonly id="bDlNumSmallx" name="bDlNumSmall"/></td>
					<td><input class="layui-input" readonly id="bCountx" name="bCount"/></td>
					<td><input class="layui-input" readonly id="aDlNumBigx" name="aDlNumBig"/></td>
					<td><input class="layui-input" readonly id="aDlNumSmallx" name="aDlNumSmall"/></td>
					<td><input class="layui-input" readonly id="aCountx" name="aCount"/></td>
					<td><input class="layui-input" readonly id="dmbjx" name="dmbj"/></td>
    			</tr>
    		</tbody>
    		<tfoot>
    			<tr>
    				<td>设备编号：</td>
    				<td>
    					<input class="layui-input layui-input-inline" id="facilityNumber" style="width: 90%" placeholder="请填写设备编号" lay-verify="">
    					<span style="color: red;display: inline">*</span>
    				</td>
    				<td>端面是否正常：</td>
    				<td>
    					<div class="layui-input-inline" style="width:90%">
	    					<select class="layui-select" id="isNormal">
								<option value="是">是</option>
								<option value="否">否</option>
							</select>
    					</div>
    				</td>
    				<td>检漏结果：</td>
    				<td>
    					<input class="layui-input layui-input-inline" style="width: 90%" id="lhResult" onclick="isPass()" readonly value="">
    					<span style="color: red;display: inline">*</span>
    				</td>
    				<td>非正常描述：</td>
    				<td><textarea class="layui-textarea layui-inline" style="width: 90%" id="describe"></textarea></td>
    			</tr>
    		</tfoot>
	</table>
	<input class="layui-hide" id="remark01" name="remark01" defaultValue="上传正面图片路径" value=""/>
	<input class="layui-hide" id="remark04" name="remark04" defaultValue="上传反面图片路径" value=""/>
	<table class="layui-table">
		<tr>
			<td style="width: 200px; height:150px"><video id="video" autoplay="autoplay" style="width:100%; height:100%; object-fit: fill;border: 1px solid red;"></video></td>
			<td style="width: 200px; height:150px"><canvas id="canvas" style="border: 1px solid red;width:100%; height:100%;"></canvas></td>
			<td align="left">
				<button type="button" class="layui-btn layui-btn-blue" onclick="getMedia()">开启摄像头</button>
				<button type="button" class="layui-btn layui-btn-blue" onclick="takePhoto()">拍照</button>
				<button type="button" class="layui-btn" id="filePos" name="file"><i class="layui-icon">&#xe67c;</i>上传正面图片</button>
				<button type="button" class="layui-btn" id="fileNeg" name="file"><i class="layui-icon">&#xe67c;</i>上传反面图片</button>
			</td>
		</tr>
	</table>
	<button type="button" id="subBtn" onclick="overSubmit()" class="layui-btn layui-btn-blue layui-inline" lay-filter="addform">提交</button>
	<button type="button" id="cancel" class="layui-btn layui-btn-blue layui-inline" >取消</button>
	<button type="reset" id="addReset" class="layui-btn layui-btn-primary layui-hide" >重置</button>
</form>

<script type="text/html" id="leakHuntingList">
    {{d.LAY_TABLE_INDEX+1}} 次检漏
</script>
<!-- 疑似不良品信息 及操作 -->
<div style="background-color: #0997F7">
	<h2 style="color:#FFF">工位：检漏工位</h2>
</div>
<div>
	<input class="layui-hide" id="sumA">
	<input class="layui-hide" id="sumB">
	<input class="layui-hide" id="ryjNumCountA">
	<input class="layui-hide" id="ryjNumCountB">
	<input class="layui-hide" id="bsNumA">
	<input class="layui-hide" id="bsNumB">
	<input class="layui-hide" id="wqysNumA">
	<input class="layui-hide" id="wqysNumB">
</div>
<div class="" style="margin:10px 0 0 15px;width: 98%">
	<div class="layui-inline">
		<label style="padding:9px 9px;float:left">产品条码：</label><input class="layui-input" id="lhCode" style="width: 200px" placeholder="请扫描产品条码" lay-verify="">
	</div>
	<!-- <div class="layui-inline">
		<label style="padding:9px 9px;float:left">设备编号：</label><input class="layui-input" id="facilityNumber" style="width: 200px" placeholder="请填写设备编号" lay-verify="">
	</div> -->
	<button class="layui-btn layui-btn-blue layui-hide" style="margin: 0 0 0 10px" id="reload" data-type="reload"><i class="layui-icon layui-icon-search">  搜索</i></button>
    <input class="layui-btn layui-btn-blue" type="button" style="padding: 0 30px;float:right" onclick = "goNumbered()" value="数点">
    <input class="layui-btn layui-btn-blue" type="button" style="padding: 0 30px;float:right" onclick = "checkTodayLog()" value="查看今日工作记录">
</div>
<div>
	<h2 style="text-align: center;color:#666">数点信息</h2>
	<table class="layui-hide" id="numbered" lay-filter="numbered"></table>
</div>
<div>
	<h2 style="text-align: center;color:#666">检漏记录</h2>
	<table class="layui-hide" id="leakHunting" lay-filter="leakHunting"></table>
</div>
<div id="details" style="background-color:rgb(242,242,242);border-top:#e6e6e6 1px solid">
    <div>
    	<table class="layui-table">
    		<thead>
    			<tr>
    				<th colspan="4"><h2 style="text-align: center;">报检信息</h2></th>
    			</tr>
    		</thead>
    		<tbody>
    			<tr>
    				<td width="20%">产品名称</td>
    				<td><input class="layui-input" readonly id="ptName"/></td>
    				<td width="20%">产品规格</td>
    				<td><input class="layui-input" readonly id="ptStandard"/></td>
    			</tr>
    			<tr>
    				<td width="20%">报检单号</td>
    				<td><input class="layui-input" readonly id="piNumber"/></td>
    				<td width="20%">质检单号</td>
    				<td><input class="layui-input" readonly id="number"/></td>
    			</tr>
    			<tr>
    				<td width="20%">报检人</td>
    				<td><input class="layui-input" readonly id="piPerson"/></td>
    				<td width="20%">报检日期</td>
    				<td><input class="layui-input" readonly id="piDate"/></td>
    			</tr>
    		</tbody>
    	</table>
    	<table class="layui-table">
    		<thead>
    			<tr>
    				<th colspan="10"><h2 style="text-align: center;">检漏</h2></th>
    			</tr>
    		</thead>
    		<tbody>
    			<tr>
    				<td width="10%">B面堵漏数（个）：大：</td>
    				<td><input class="layui-input" onFocus="this.value=''" oninput="bOninputBig()"  value= "0" type="number" id="bDlNumBig"/></td>
    				<td width="10%">B面堵漏数（个）：小：</td>
    				<td><input class="layui-input" onFocus="this.value=''" oninput="bOninputSmall()"  value= "0" type="number" id="bDlNumSmall"/></td>
    				<td width="10%">B面堵漏总数</td>
    				<td><input class="layui-input" readonly  value= "0" type="number" id="bCount"/></td>
    				<td width="10%">B面N次堵漏总数</td>
    				<td><input class="layui-input" readonly  value= "0" type="number" id="bCountN"/></td>
    				<td width="10%">MAX(N次检漏A总数，N次检漏B总数)【合格】</td>
    				<td><input class="layui-input" readonly  value= "${zcLeakHuntingCriterionEntity.nleakHuntingCountOne }"/></td>
    			</tr>
    			<tr>
    				<td width="10%">A面堵漏数（个）：大：</td>
    				<td><input class="layui-input" onFocus="this.value=''" oninput="aOninputBig()"  value= "0" type="number" id="aDlNumBig"/></td>
    				<td width="10%">A面堵漏数（个）：小：</td>
    				<td><input class="layui-input" onFocus="this.value=''" oninput="aOninputSmall()"  value= "0" type="number" id="aDlNumSmall"/></td>
    				<td width="10%">A面堵漏总数</td>
    				<td><input class="layui-input" readonly value= "0" type="number" id="aCount"/></td>
    				<td width="10%">A面N次堵漏总数</td>
    				<td><input class="layui-input" readonly  value= "0" type="number" id="aCountN"/></td>
    				<td width="10%">MAX(N次检漏A总数，N次检漏B总数)【异常】</td>
    				<td><input class="layui-input" readonly  value= "${zcLeakHuntingCriterionEntity.nleakHuntingCountTwo }"/></td>
    			</tr>
    			<tr>
    				<td width="10%">端面补胶用量</td>
    				<td>
						<input class="layui-input" onFocus="this.value=''"  value= "0" type="number" id="dmbj"/>
					</td>
    				<!-- <td width="10%">检漏是否正常</td>
    				<td>
						<select class="layui-select" id="isNormal">
			   				<option value="是">是</option>
			   				<option value="否">否</option>
		   				</select>
					</td> -->
    				<!-- <td width="10%">检漏结果</td>
    				<td colspan="1">
    					<select class="layui-select" id="lhResult">
			   				<option value="合格">合格</option>
			   				<option value="降级">降级</option>
			   				<option value="异常处理">异常处理</option>
		   				</select>
		   				<input class="layui-input" id="lhResult" onclick="isPass()" readonly value="">			
	    			</td>
	    			<td width="10%">非正常描述</td>
    				<td colspan="3"><textarea class="layui-textarea" id="describe"></textarea></td> -->
    			</tr>
    		</tbody>
    	</table>
    	<!-- <input class="layui-hide" id="remark01" name="remark01" defaultValue="上传图片路径" value=""/> -->
    	<!-- <table class="layui-table">
    			<tr>
					<td style="width: 200px; height:150px"><video id="video" autoplay="autoplay" style="width:100%; height:100%; object-fit: fill;border: 1px solid red;"></video></td>
					<td style="width: 200px; height:150px"><canvas id="canvas" style="border: 1px solid red;width:100%; height:100%;"></canvas></td>
					<td align="left">
						<button class="layui-btn layui-btn-blue" onclick="getMedia()">开启摄像头</button>
						<button class="layui-btn layui-btn-blue" onclick="takePhoto()">拍照</button>
						<button type="button" class="layui-btn" id="file" name="file"><i class="layui-icon">&#xe67c;</i>上传图片</button>
					</td>
				</tr>
    	</table> -->
    	<input style="color:red" class="layui-input" value="* 注：每个组件的各项检漏数全部小于等于【合格】则组件合格，若有一项检漏数大于等于【异常】则组件异常，否则降级"/>
    	<input id="testTime" hidden/>
    	<div class="layui-form-item" style="width:100%">
	   		<div class="" style="margin:10px 0 0 10px">
		  		<input class="layui-btn layui-btn-blue layui-hide" type="button" style="padding: 0 30px" onclick = "save()" id="firstBtn" value="立即提交">
		  		<input class="layui-btn layui-btn-blue" type="button" style="padding: 0 30px" onclick = "second()" id="secondBtn" value="保存">
		  		<input class="layui-btn layui-btn-blue" type="button" style="padding: 0 30px" onclick = "over()" id="thirdBtn" value="提交">
		  		<input class="layui-btn layui-btn-blue" type="button" style="padding: 0 30px" onclick = "logout()" value="注销">
			</div>
		</div>
    </div>
</div>
<script src="${pageContext.request.contextPath }/assets/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/layui.all.js"></script>
<script src="${pageContext.request.contextPath }/assets/js/jquery.min.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/js/toastr.min.js" charset="utf-8"></script>
<script type="text/javascript">
//数据输入改变事件
function bOninputBig(){
	var bDlNumBig = Number($("#bDlNumBig").val());
	var bDlNumSmall = Number($("#bDlNumSmall").val());
	$("#bCount").val(bDlNumBig+bDlNumSmall);
	$("#bCountN").val(Number($("#sumB").val())+bDlNumBig+bDlNumSmall);
	var lhCode = $("#lhCode").val();
	if(lhCode==""){
		toastr.warning("请扫描条形码！");
		setTimeout(function(){  //使用  setTimeout（）方法设定定时500毫秒
			window.location.reload();  
		},1000);
	}
}
function bOninputSmall(){
	var bDlNumBig = Number($("#bDlNumBig").val());
	var bDlNumSmall = Number($("#bDlNumSmall").val());
	$("#bCount").val(bDlNumBig+bDlNumSmall);
	$("#bCountN").val(Number($("#sumB").val())+bDlNumBig+bDlNumSmall);
	var lhCode = $("#lhCode").val();
	if(lhCode==""){
		toastr.warning("请扫描条形码！");
		setTimeout(function(){  //使用  setTimeout（）方法设定定时500毫秒
			window.location.reload();  
		},1000);
	}
}
function aOninputBig(){
	var aDlNumBig = Number($("#aDlNumBig").val());
	var aDlNumSmall = Number($("#aDlNumSmall").val());
	$("#aCount").val(aDlNumBig+aDlNumSmall);
	$("#aCountN").val(Number($("#sumA").val())+aDlNumBig+aDlNumSmall);
	var lhCode = $("#lhCode").val();
	if(lhCode==""){
		toastr.warning("请扫描条形码！");
		setTimeout(function(){  //使用  setTimeout（）方法设定定时500毫秒
			window.location.reload();  
		},1000);
	}
}
function aOninputSmall(){
	var aDlNumBig = Number($("#aDlNumBig").val());
	var aDlNumSmall = Number($("#aDlNumSmall").val());
	$("#aCount").val(aDlNumBig+aDlNumSmall);
	$("#aCountN").val(Number($("#sumA").val())+aDlNumBig+aDlNumSmall);
	var lhCode = $("#lhCode").val();
	if(lhCode==""){
		toastr.warning("请扫描条形码！");
		setTimeout(function(){  //使用  setTimeout（）方法设定定时500毫秒
			window.location.reload();  
		},1000);
	}
}
//判定是否合格
function isPass(){
	$.ajax({
   	 url:'${pageContext.request.contextPath }/criterion/selectLeakHuntingCriterion.do'
			,type:'post'
			,dataType:'json'
			,success:function(data){
				var ryjNumCountA = $("#ryjNumCountA").val();
				var ryjNumCountB = $("#ryjNumCountB").val();
				var bsNumA = $("#bsNumA").val();
				var bsNumB = $("#bsNumB").val();
				var wqysNumA = $("#wqysNumA").val();
				var wqysNumB = $("#wqysNumB").val();
				var dmbj = Number($("#dmbjx").val());
				var sumA = Number($("#sumA").val())+Number($("#aCountx").val());
				var sumB = Number($("#sumB").val())+Number($("#bCountx").val());
				if(Math.max(ryjNumCountA,ryjNumCountB)<=data.ryCountOne&&Math.max(bsNumA,bsNumB)<=data.bsCountOne&&Math.max(wqysNumA,wqysNumB)<=data.wsCountOne&&Math.max(sumA,sumB)<=data.nleakHuntingCountOne&&dmbj==data.dmbjOne){
					$("#lhResult").val("合格")
				}else if(Math.max(ryjNumCountA,ryjNumCountB)>=data.ryCountTwo||Math.max(bsNumA,bsNumB)>=data.bsCountTwo||Math.max(wqysNumA,wqysNumB)>=data.wsCountTwo||Math.max(sumA,sumB)>=data.nleakHuntingCountTwo||dmbj>=data.dmbjTwo){
					$("#lhResult").val("异常处理")
				}else{
					$("#lhResult").val("降级")
				}
				
			}
    })
	
	
}
//查看今日工作量
function checkTodayLog(){
	layer.open({
        type: 1 					//Page层类型
        ,area: ['95%', '600px']   //宽  高
        ,title: '今日检漏记录'
        ,shade: 0.6 				//遮罩透明度
        ,maxmin: true			    //允许全屏最小化
        ,anim: 1 					//0-6的动画形式，-1不开启
        /* ,content: $("#lookupTable2") */
        ,content: '<table class="layui-hide" id="todayLog" lay-filter="todayLog"></table>'
        ,success:function(){
            layui.use(['table'], function(){
                var table = layui.table;
                table.render({
                    elem: '#todayLog'
                    ,url:'${pageContext.request.contextPath }/leakHunting/selectTodayLogListCount.do'
                    ,title: '今日检漏记录'
                    ,limits:[10,20,30]
                    ,done:function(res, curr, count) { //表格数据加载完后的事件
                        //调用示例
                        layer.photos({//点击图片弹出
                            photos: '.layer-photos-demo'
                            ,anim: 1 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
                        	,area: ['800px','600px']
                        });
                    }
                    ,cols: [[
                        {field:'', title:'序号', sort: true, type:'numbers', width: 60}
                        ,{field:'number', title:'质检单号',align:'center'}
                        ,{field:'lhCode', title:'产品条码',align:'center'}
                        ,{field:'remark05',title:'检漏次数',align:'center'}
                    ]]
                    ,page: true
                });
              	//行点击事件
				table.on('row(todayLog)', function(obj){
					var data = obj.data;
					var lhCode = data.lhCode;
					layer.open({
				        type: 1 					//Page层类型
				        ,area: ['95%', '600px']   //宽  高
				        ,title: lhCode
				        ,shade: 0.6 				//遮罩透明度
				        ,maxmin: true			    //允许全屏最小化
				        ,anim: 1 					//0-6的动画形式，-1不开启
				        /* ,content: $("#lookupTable2") */
				        ,content: '<table class="layui-hide" id="todayLogDetails" lay-filter="todayLogDetails"></table>'
				        ,success:function(){
				            layui.use(['table'], function(){
				                var table = layui.table;
				                table.render({
				                    elem: '#todayLogDetails'
				                    ,url:'${pageContext.request.contextPath }/leakHunting/selectTodayLogList.do?code='+lhCode
				                    ,title: '今日检漏记录详情'
				                    ,limits:[10,20,30]
				                    ,done:function(res, curr, count) { //表格数据加载完后的事件
				                        //调用示例
				                        layer.photos({//点击图片弹出
				                            photos: '.layer-photos-demo'
				                            ,anim: 1 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
				                        	,area: ['800px','600px']
				                        });
				                    }
				                    ,cols: [[
				                        {field:'', title:'序号', sort: true, type:'numbers', width: 60}
				                        ,{field:'number', title:'质检单号'}
				                        ,{field:'lhCode', title:'产品条码'}
				                        ,{field:'facilityNumber', title:'设备编号'}
				                        ,{field:'aDlNumBig', title:'A面堵漏个数大'}
				                        ,{field:'aDlNumSmall', title:'A面堵漏个数小'}
				                        ,{field:'aCount', title:'A面堵漏总数'}
				                        ,{field:'bDlNumBig', title:'B面堵漏个数大'}
				                        ,{field:'bDlNumSmall', title:'B面堵漏个数小'}
				                        ,{field:'bCount', title:'B面堵漏总数'}
				                        ,{field:'isNormal', title:'检漏是否正常'}
				                        ,{field:'dmbj', title:'端面补胶'}
				                        ,{field:'lhResult', title:'检漏结果'}
				                        ,{field:'describe', title:'问题描述'}
				                        ,{field:'remark01', title:'查看正面图片',templet:function(row){
				                        	if(row.remark01 == ''){
				                        		return "无图片";
				                        	}else{
				                        		 return "<div class='layer-photos-demo' id='imgview'><img layer-pid='pid1' layer-src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark01 + "' src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark01 + "' alt='查看正面图片' style='height:35px;'/></div>"
				                        	}
				          		      	}}
				                        ,{field:'remark04', title:'查看反面图片',templet:function(row){
				                        	if(row.remark04 == ''){
				                        		return "无图片";
				                        	}else{
				                        		 return "<div class='layer-photos-demo' id='imgview'><img layer-pid='pid1' layer-src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark04 + "' src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark04 + "' alt='查看反面图片' style='height:35px;'/></div>"
				                        	}
				          		      	}}
				                        ,{field:'testPerson', title:'检验人'}
				                        ,{field:'testTime', title:'检验时间',width:150,templet :function (row){
				                            	return date2String(row.testTime);
				                        	}   
				                        }
				                    ]]
				                    ,page: true
				                });
				            });
				        }
					})
				})
            });
        }
	})
}

window.onload = function(){
	var oInput = document.getElementById("lhCode");
	oInput.focus();
}
layui.use(['table','layer','upload','form'], function(){
	var table = layui.table;
	var layer = layui.layer,
    form = layui.form;
	
	var $ = layui.jquery, active = {
			reload:function () {
				var productCode = $("#lhCode").val();
				table.reload('contenttable',{
					method:'get',
					where:{productCode:productCode}
					,page: {
						curr: 1 //重新从第 1 页开始
					}
				});
				table.reload('contenttable2',{
					method:'get',
					where:{productCode:productCode}
					,page: {
						curr: 1 //重新从第 1 页开始
					}
				});
			}
		}
	$('.layui-btn').on('click', function(){
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });
	table.render({
	    elem: '#numbered'
	    ,url:'${pageContext.request.contextPath }/leakHunting/selectNumberedInfoByCode.do'
	    ,title: '数点信息'
	    ,id :'contenttable2'
	    ,limits:[10,20,30]
	    ,done:function(res, curr, count) { //表格数据加载完后的事件
            //调用示例
            layer.photos({//点击图片弹出
                photos: '.layer-photos-demo'
                ,anim: 1 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            	,area: ['800px','600px']
            });
        }
	    ,cols: [[
			  {field:'', title:'序号', sort: true, type:'numbers', width: 60}
			  ,{field:'rjNumA', title:'A面软胶堵漏数'}
		      ,{field:'rjNumB', title:'B面软胶堵漏数'}
		      ,{field:'yjNumA', title:'A面硬胶堵漏数'}
		      ,{field:'yjNumB', title:'B面硬胶堵漏数'}
		      ,{field:'ryjNumCountA', title:'A面软硬胶堵漏总数'}
		      ,{field:'ryjNumCountB', title:'B面软硬胶堵漏总数'}
		      ,{field:'bsNumA', title:'A面瘪丝数'}
		      ,{field:'bsNumB', title:'B面瘪丝数'}
		      ,{field:'wqysNumA', title:'A面弯曲压丝数'}
		      ,{field:'wqysNumB', title:'B面弯曲压丝数'}
		      ,{field:'isNormal', title:'端面是否正常'}
		      ,{field:'place', title:'异常位置'}
		      ,{field:'describe', title:'非正常描述'}
		      ,{field:'remark01', title:'查看正面图片',templet:function(row){
		    	  	if(row.remark01 == ''){
              			return "无图片";
		           	}else{
		           	 	return "<div class='layer-photos-demo' id='imgview'><img layer-pid='pid1' layer-src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark01 + "' src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark01 + "' alt='查看正面图片' style='height:35px;'/></div>"
		           	}
		      }}
		      ,{field:'remark06', title:'查看反面图片',templet:function(row){
		    	  	if(row.remark06 == ''){
              			return "无图片";
		           	}else{
		           	 	return "<div class='layer-photos-demo' id='imgview'><img layer-pid='pid1' layer-src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark06 + "' src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark06 + "' alt='查看反面图片' style='height:35px;'/></div>"
		           	}
		      }}
		      ,{field:'testPerson', title:'数点人'}
		      ,{field:'testTime',width:160, title:'数点日期',templet:function (row){
            		return date2String(row.testTime);
        		}
		      }
		    ]]
	    ,page: false
	});
	table.render({
	    elem: '#leakHunting'
	    ,url:'${pageContext.request.contextPath }/productTracing/selectLeakHuntingInfoByCode.do'
	    ,title: '检漏记录'
	    ,id :'contenttable'
	    ,totalRow: true
	    ,limits:[10,20,30]
	    ,done:function(res, curr, count) { //表格数据加载完后的事件
            //调用示例
            layer.photos({//点击图片弹出
                photos: '.layer-photos-demo'
                ,anim: 1 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            	,area: ['800px','600px']
            });
        }
	    ,cols: [[
			   {field:'', title:'序号', sort: true, type:'numbers', width: 60}
			  ,{field:'leakHunting',width:100, title: '检漏序列',templet:'#leakHuntingList',totalRowText: '合计'}
		      ,{field:'facilityNumber', title:'设备编号'}
		      ,{field:'aDlNumBig', title:'A面堵漏个数大'}
		      ,{field:'aDlNumSmall', title:'A面堵漏个数小'}
		      ,{field:'bDlNumBig', title:'B面堵漏个数大'}
		      ,{field:'bDlNumSmall', title:'B面堵漏个数小'}
		      ,{field:'aCount', title:'A面总数',totalRow: true}
		      ,{field:'bCount', title:'B面总数',totalRow: true}
		      ,{field:'isNormal', title:'检漏是否正常'}
		      ,{field:'dmbj', title:'端面补胶'}
		      ,{field:'lhResult', title:'检漏结果'}
		      ,{field:'describe', title:'非正常描述'}
		      ,{field:'remark01', title:'查看正面图片',templet:function(row){
		    	  	if(row.remark01 == ''){
            			return "无图片";
		           	}else{
		           	 	return "<div class='layer-photos-demo' id='imgview'><img layer-pid='pid1' layer-src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark01 + "' src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark01 + "' alt='查看正面图片' style='height:35px;'/></div>"
		           	}
		      }}
		      ,{field:'remark04', title:'查看反面图片',templet:function(row){
		    	  	if(row.remark04 == ''){
            			return "无图片";
		           	}else{
		           	 	return "<div class='layer-photos-demo' id='imgview'><img layer-pid='pid1' layer-src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark04 + "' src='${pageContext.request.contextPath }/attachment/samplekeep" + row.remark04 + "' alt='查看反面图片' style='height:35px;'/></div>"
		           	}
		      }}
		      ,{field:'testTime',width:160, title:'日期',templet:function (row){
            		return date2String(row.testTime);
        		}
		      }
		    ]]
	    ,done:function(data){
	    	var index = data.data.length-1;
	    	if(index>=0){
		    	if("已判定"==data.data[index].remark05){
		    		$("#secondBtn").attr("disabled",true);
		    		$("#secondBtn").css("background","#AAA");
		    		$("#thirdBtn").attr("disabled",true);
		    		$("#thirdBtn").css("background","#AAA");
		    	}else{
		    		$("#secondBtn").attr("disabled",false);
		    		$("#secondBtn").css("background","#009688");
		    		$("#thirdBtn").attr("disabled",false);
		    		$("#thirdBtn").css("background","#009688");
		    	}
	    	}
	    	if(data.count!='0'){
	    		$("#firstBtn").attr("disabled",true);
	    		$("#firstBtn").css("background","#AAA");
	    	}
	    }
	    ,page: true
	});
});
//注销
function logout(){   
	 window.location.href="${pageContext.request.contextPath }/logout.do";
 }
//进入数点
function goNumbered(){
	 window.location.href="${pageContext.request.contextPath }/numbered/enterNumberedPage.do";
}
//日期格式转换
function date2String(timestamp){
	var d = new Date(timestamp);
	var date = (d.getFullYear()) + "-" + 
       (d.getMonth() + 1<10?"0"+(d.getMonth() + 1):d.getMonth() + 1) + "-" +
       (d.getDate()<10?"0"+d.getDate():d.getDate()) + " " + 
       (d.getHours()<10?"0"+d.getHours():d.getHours()) + ":" + 
       (d.getMinutes()<10?"0"+d.getMinutes():d.getMinutes()) + ":" + 
       (d.getSeconds()<10?"0"+d.getSeconds():d.getSeconds());
       
       return date;
}
function keyDown(e){
    //IE内核浏览器  
     if (navigator.appName == 'Microsoft Internet Explorer'){  
           var keycode = event.keyCode;  
           var realkey = String.fromCharCode(event.keyCode);  
     }else {//非IE内核浏览器  
           var keycode = e.which;  
           var realkey = String.fromCharCode(e.which);  
     }  
   // console.log('按键码:' + keycode +  '字符: ' + realkey);  

   //监听Enter键  
   if(keycode==13){  
	    var d = new Date();
	    var date = (d.getFullYear()) + "-" + 
           (d.getMonth() + 1<10?"0"+(d.getMonth() + 1):d.getMonth() + 1) + "-" +
           (d.getDate()<10?"0"+d.getDate():d.getDate()) + " " + 
           (d.getHours()<10?"0"+d.getHours():d.getHours()) + ":" + 
           (d.getMinutes()<10?"0"+d.getMinutes():d.getMinutes()) + ":" + 
           (d.getSeconds()<10?"0"+d.getSeconds():d.getSeconds());
           $("#testTime").val(date);
         var code = $("#lhCode").val();
         $.ajax({
        	 url:'${pageContext.request.contextPath }/numbered/selectProductTest.do'
 				,type:'post'
 				,data:{"code":code}
 				,dataType:'json'
 				,success:function(data){
 					if(data == 0){
 						toastr.warning("未找到订单！请先数点");
 						setTimeout(function(){  //使用  setTimeout（）方法设定定时500毫秒
 							window.location.reload();  
 						},2000);
 					}else{
 						$.ajax({
 							url:'${pageContext.request.contextPath }/leakHunting/selectNumberedInfoByCode.do'
							,type:'post'
			 				,data:{"productCode":code}
			 				,dataType:'json'
			 				,success:function(data1){
			 					//alert(data1.data.length)
			 					if(data1.data.length==0){
			 						toastr.warning("请先进行数点操作！");
			 						$("#secondBtn").attr("disabled",true);
			 	     	    		$("#secondBtn").css("background","#AAA");
			 						$("#thirdBtn").attr("disabled",true);
			 	     	    		$("#thirdBtn").css("background","#AAA");
			 					}else{
			 						$("#secondBtn").attr("disabled",false);
			 						$("#secondBtn").css("background","#009688");
			 						$("#thirdBtn").attr("disabled",false);
			 						$("#thirdBtn").css("background","#009688");
			 					}
			 				}
 						})
 						$("#reload").click();
 						$("#ptName").val(data.ptName);
 	 					$("#ptStandard").val(data.ptStandard);
 	 					$("#piNumber").val(data.piNumber);
 	 					$("#number").val(data.number);
 	 					$("#piPerson").val(data.piPerson);
 	 					$("#piDate").val(date2String(data.piDate));
 					}
 				}
         })
         $.ajax({
        	 url:'${pageContext.request.contextPath }/leakHunting/selectLeakHuntingSumN.do'
 				,type:'post'
 				,data:{"productCode":code}
 				,dataType:'json'
 				,success:function(data){
 					//console.log(data);
 					$("#sumA").val(data.aCount);
 					$("#sumB").val(data.bCount);
 				}
         })
         $.ajax({
        	 url:'${pageContext.request.contextPath }/leakHunting/selectNumberedInfoByCode.do'
 				,type:'post'
 				,data:{"productCode":code}
 				,dataType:'json'
 				,success:function(data){
 					//console.log(data.data[0].ryjNumCountA);
 					$("#ryjNumCountA").val(data.data[0].ryjNumCountA);
 					$("#ryjNumCountB").val(data.data[0].ryjNumCountB);
 					$("#bsNumA").val(data.data[0].bsNumA);
 					$("#bsNumB").val(data.data[0].bsNumB);
 					$("#wqysNumA").val(data.data[0].wqysNumA);
 					$("#wqysNumB").val(data.data[0].wqysNumB);
 				}
         })
         $.ajax({
        	 url:'${pageContext.request.contextPath }/leakHunting/selectLeakHuntingTabByCode.do'
 				,type:'post'
 				,data:{"code":code}
 				,dataType:'json'
 				,success:function(data){
 					$("#codex").val(data.code);
 					$("#bDlNumBigx").val(data.bDlNumBig);
 					$("#bDlNumSmallx").val(data.bDlNumSmall);
 					$("#bCountx").val(data.bCount);
 					$("#aDlNumBigx").val(data.aDlNumBig);
 					$("#aDlNumSmallx").val(data.aDlNumSmall);
 					$("#aCountx").val(data.aCount);
 					$("#dmbjx").val(data.dmbj);
 				}
         })
   }  
   
}  
//按键事件
document.onkeydown=keyDown;		
//保存
/* function save(){
	$("#firstBtn").attr("disabled",true);
	var lhCode = $("#lhCode").val();
	var lhResult = $("#lhResult").val();
	if(lhCode==""){
		toastr.warning("请先扫描条形码！");
		setTimeout(function(){  //使用  setTimeout（）方法设定定时500毫秒
			window.location.reload();  
		},1000);
	}else if(lhResult==""){
		toastr.warning("请选择检验结果！");
		setTimeout(function(){  //使用  setTimeout（）方法设定定时500毫秒
			window.location.reload();  
		},1000);
	}else{
		var number = $("#number").val();
		var facilityNumber = $("#facilityNumber").val();
		var bDlNumBig = $("#bDlNumBig").val()==''?0:$("#bDlNumBig").val();
		var bDlNumSmall = $("#bDlNumSmall").val()==''?0:$("#bDlNumSmall").val();
		var bCount = $("#bCount").val();
		var aDlNumBig = $("#aDlNumBig").val()==''?0:$("#aDlNumBig").val();
		var aDlNumSmall = $("#aDlNumSmall").val()==''?0:$("#aDlNumSmall").val();
		var aCount = $("#aCount").val();
		var isNormal = $("#isNormal").val();
		var dmbj = $("#dmbj").val()==''?0:$("#dmbj").val();
		var describe = $("#describe").val();
		var testTime = $("#testTime").val();
		var ptName = $("#ptName").val();
		var ptStandard = $("#ptStandard").val();
		var tInsPerson = $("#piPerson").val();
		var tInsDate = $("#piDate").val();
		var tStation = "检漏工位";
		var remark01 = $("#remark01").val();
		if(facilityNumber == ""){
			toastr.warning("请输入设备编号！");
			setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
				window.location.reload();  
			},2000);
		}else{
			$.ajax({
				type:'post'
				,url:'${pageContext.request.contextPath }/leakHunting/insertLeakHunting.do'
				,data:{number:number,lhCode:lhCode,facilityNumber:facilityNumber,bDlNumBig:bDlNumBig,bDlNumSmall:bDlNumSmall,bCount:bCount,aDlNumBig:aDlNumBig,aDlNumSmall:aDlNumSmall,aCount:aCount,dmbj:dmbj,isNormal:isNormal,describe:describe,lhResult:lhResult,testTime:testTime,remark01:remark01}
				,dataType:'json'
				,success:function(res){
					if(res>0){
						toastr.success("保存成功！");
						setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
							window.location.reload();  
						},2000);
					}else{
						toastr.error("保存失败！");
					}
				}
			})
		}
	}
	
} */
//二次检漏（新保存）
function second(){
	$("#secondBtn").attr("disabled",true);
	$("#firstBtn").attr("disabled",true);
	var lhCode = $("#lhCode").val();
	if(lhCode==""){
		toastr.warning("请先扫描条形码！");
		$("#secondBtn").attr("disabled",false);
		$("#firstBtn").attr("disabled",false);
	}else{
		var bDlNumBig = $("#bDlNumBig").val()==''?0:$("#bDlNumBig").val();
		var bDlNumSmall = $("#bDlNumSmall").val()==''?0:$("#bDlNumSmall").val();
		var bCount = $("#bCount").val();
		var aDlNumBig = $("#aDlNumBig").val()==''?0:$("#aDlNumBig").val();
		var aDlNumSmall = $("#aDlNumSmall").val()==''?0:$("#aDlNumSmall").val();
		var aCount = $("#aCount").val();
		var dmbj = $("#dmbj").val()==''?0:$("#dmbj").val();
		$.ajax({
			type:'post'
			,url:'${pageContext.request.contextPath }/leakHunting/saveLeakHunting.do'
			,data:{code:lhCode,bDlNumBig:bDlNumBig,bDlNumSmall:bDlNumSmall,bCount:bCount,aDlNumBig:aDlNumBig,aDlNumSmall:aDlNumSmall,aCount:aCount,dmbj:dmbj}
			,dataType:'json'
			,success:function(res){
				if(res>0){
					toastr.success("保存成功！");
					setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
						window.location.reload();  
					},2000);
				}else{
					toastr.error("保存失败！");
				}
			}
		})
	}
}
//最终处理
/* function over(){
	$("#thirdBtn").attr("disabled",true);
	var lhCode = $("#lhCode").val();
	var lhResult = $("#lhResult").val();
	if(lhCode==""){
		toastr.warning("请先扫描条形码！");
		setTimeout(function(){  //使用  setTimeout（）方法设定定时500毫秒
			window.location.reload();  
		},1000);
	}else if(lhResult==""){
		toastr.warning("请选择检验结果！");
		setTimeout(function(){  //使用  setTimeout（）方法设定定时500毫秒
			window.location.reload();  
		},1000);
	}else{
		var number = $("#number").val();
		var facilityNumber = $("#facilityNumber").val();
		var bDlNumBig = $("#bDlNumBig").val();
		var bDlNumBig = $("#bDlNumBig").val()==''?0:$("#bDlNumBig").val();
		var bDlNumSmall = $("#bDlNumSmall").val()==''?0:$("#bDlNumSmall").val();
		var bCount = $("#bCount").val();
		var aDlNumBig = $("#aDlNumBig").val()==''?0:$("#aDlNumBig").val();
		var aDlNumSmall = $("#aDlNumSmall").val()==''?0:$("#aDlNumSmall").val();
		var aCount = $("#aCount").val();
		var isNormal = $("#isNormal").val();
		var dmbj = $("#dmbj").val()==''?0:$("#dmbj").val();
		var describe = $("#describe").val();
		var testTime = $("#testTime").val();
		var ptName = $("#ptName").val();
		var ptStandard = $("#ptStandard").val();
		var tInsPerson = $("#piPerson").val();
		var tInsDate = $("#piDate").val();
		var tStation = "检漏工位";
		var remark01 = $("#remark01").val();
		var remark05 = "已判定";
		if(facilityNumber==""){
			toastr.warning("请输入设备编号！");
			setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
				window.location.reload();  
			},2000);
		}else{
			$.ajax({
				type:'post'
				,url:'${pageContext.request.contextPath }/leakHunting/insertLeakHunting.do'
				,data:{number:number,lhCode:lhCode,facilityNumber:facilityNumber,bDlNumBig:bDlNumBig,bDlNumSmall:bDlNumSmall,bCount:bCount,aDlNumBig:aDlNumBig,aDlNumSmall:aDlNumSmall,aCount:aCount,dmbj:dmbj,isNormal:isNormal,describe:describe,lhResult:lhResult,testTime:testTime,remark05:remark05,remark01:remark01}
				,dataType:'json'
				,success:function(res){
					if(res>0){
						if(lhResult=="异常处理"){
							//异常判定推送到不合格处置
							$.ajax({
								type:'post'
								,url:'${pageContext.request.contextPath }/leakHunting/insertProductToTest.do'
								,data:{tNumber:number,tCode:lhCode,tName:ptName,tStandard:ptStandard,tWay:lhResult,tStatus:"0",tTestDate:testTime,tInsPerson:tInsPerson,tInsDate:tInsDate,tStation:tStation}
								,dataType:'json'
							})
						} 
						toastr.success("提交成功！");
						setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
							window.location.reload();  
						},2000);
					}else{
						toastr.error("提交失败！");
					}
				}
			})
		}
	}
	
} */
//最终处理（新提交）
function over(){
	var lhCode = $("#lhCode").val();
	if(lhCode==""){
		toastr.warning("请先扫描条形码！");
		/* setTimeout(function(){  //使用  setTimeout（）方法设定定时500毫秒
			window.location.reload();  
		},1000); */
	}else{
		layer.open({
	        type: 1 					//Page层类型
	        ,area: ['95%', '600px']   //宽  高
	        ,title: '确认提交'
	        ,shade: 0.6 				//遮罩透明度
	        ,maxmin: true			    //允许全屏最小化
	        ,anim: 1 					//0-6的动画形式，-1不开启
	        /* ,content: $("#lookupTable2") */
	        ,content: $("#addFormId")
	        ,success:function(){
	        	
	        }
			,end: function () {
            	$("#addFormId").css("display","none");
            	$("#addReset").click();
            	$.ajax({
               	 url:'${pageContext.request.contextPath }/leakHunting/selectLeakHuntingTabByCode.do'
        				,type:'post'
        				,data:{"code":lhCode}
        				,dataType:'json'
        				,success:function(data){
        					$("#codex").val(data.code);
        					$("#bDlNumBigx").val(data.bDlNumBig);
        					$("#bDlNumSmallx").val(data.bDlNumSmall);
        					$("#bCountx").val(data.bCount);
        					$("#aDlNumBigx").val(data.aDlNumBig);
        					$("#aDlNumSmallx").val(data.aDlNumSmall);
        					$("#aCountx").val(data.aCount);
        					$("#dmbjx").val(data.dmbj);
        				}
                })
        	}
		})
	}
}
//提交
function overSubmit(){
	var lhCode = $("#lhCode").val();
	var lhResult = $("#lhResult").val();
	$("#subBtn").attr("disabled",true);
	var number = $("#number").val();
	var facilityNumber = $("#facilityNumber").val();
	var bDlNumBig = $("#bDlNumBigx").val();
	var bDlNumBig = $("#bDlNumBigx").val()==''?0:$("#bDlNumBigx").val();
	var bDlNumSmall = $("#bDlNumSmallx").val()==''?0:$("#bDlNumSmallx").val();
	var bCount = $("#bCountx").val();
	var aDlNumBig = $("#aDlNumBigx").val()==''?0:$("#aDlNumBigx").val();
	var aDlNumSmall = $("#aDlNumSmallx").val()==''?0:$("#aDlNumSmallx").val();
	var aCount = $("#aCountx").val();
	var isNormal = $("#isNormal").val();
	var dmbj = $("#dmbjx").val()==''?0:$("#dmbjx").val();
	var describe = $("#describe").val();
	var testTime = $("#testTime").val();
	var ptName = $("#ptName").val();
	var ptStandard = $("#ptStandard").val();
	var tInsPerson = $("#piPerson").val();
	var tInsDate = $("#piDate").val();
	var tStation = "检漏工位";
	var remark01 = $("#remark01").val();
	var remark04 = $("#remark04").val();
	var remark05 = "已判定";
	if(facilityNumber==""){
		toastr.warning("请输入设备编号！");
		$("#subBtn").attr("disabled",false);
	}else if(lhResult==""){
		toastr.warning("请选择检验结果！");
		$("#subBtn").attr("disabled",false);
	}else{
		$.ajax({
			type:'post'
			,url:'${pageContext.request.contextPath }/leakHunting/insertLeakHunting.do'
			,data:{number:number,lhCode:lhCode,facilityNumber:facilityNumber,bDlNumBig:bDlNumBig,bDlNumSmall:bDlNumSmall,bCount:bCount,aDlNumBig:aDlNumBig,aDlNumSmall:aDlNumSmall,aCount:aCount,dmbj:dmbj,isNormal:isNormal,describe:describe,lhResult:lhResult,testTime:testTime,remark05:remark05,remark01:remark01,remark04:remark04}
			,dataType:'json'
			,success:function(res){
				if(res>0){
					if(lhResult=="异常处理"){
						//异常判定推送到不合格处置
						$.ajax({
							type:'post'
							,url:'${pageContext.request.contextPath }/leakHunting/insertProductToTest.do'
							,data:{tNumber:number,tCode:lhCode,tName:ptName,tStandard:ptStandard,tWay:lhResult,tStatus:"0",tTestDate:testTime,tInsPerson:tInsPerson,tInsDate:tInsDate,tStation:tStation}
							,dataType:'json'
						})
					} 
					toastr.success("提交成功！");
					setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
						window.location.reload();  
					},2000);
				}else{
					toastr.error("提交失败！");
				}
			}
		})
	}
}
//开启摄像头
function getMedia() {
    let constraints = {
        video: {width: 200, height: 150},
        audio: true
    };
    let promise = navigator.mediaDevices.getUserMedia(constraints);
    promise.then(function (MediaStream) {
        video.srcObject = MediaStream;
        video.play();
    });
}

//拍照上传
function takePhoto() {
 	//获得Canvas对象
 	let video = document.getElementById("video");
 	let canvas = document.getElementById("canvas");
 	let ctx = canvas.getContext('2d');
 	//在画布坐标（0,0）的位置绘制一张宽度为300，高度为200的图片
 	ctx.drawImage(video, 0, 0, 300, 150);
 	var timestamp = Date.parse(new Date());
 	downloadCanvasIamge('canvas', timestamp);
}

// 下载Canvas元素获取的图片
function downloadCanvasIamge(selector, name) {
    // 通过选择器获取canvas元素
    var canvas = document.querySelector(selector);
    var url = canvas.toDataURL('image/png');
    var a = document.createElement('a');
    var event = new MouseEvent('click');
    a.download = name || Date.parse(new Date());
    a.href = url;
    // 触发a的单击事件
    a.dispatchEvent(event);
}
layui.use(['table','layer','upload','form','laydate'], function(){
	var table = layui.table;
	var layer = layui.layer;
	var laydate = layui.laydate;
    var form = layui.form;
    var upload = layui.upload;
	//多文件上传
    upload.render({
      elem: '#filePos'
      ,url: '${pageContext.request.contextPath}/upload/picUpload.do'
      ,multiple: true
      //允许上传的文件类型
      ,exts: 'jpg|png|gif|jpeg|PNG|zip|rar|txt|doc|docx|xls|xlsx|ppt|pptx|mp3|mp4|avi|flv|rm|rmvb|'
      /* ,before: function(obj){
        //预读本地文件示例，不支持ie8
		obj.preview(function(index, file, result){
          	$('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
        });
      } */
      ,done: function(res){
        //上传完毕
   	  if(res != "" && res != null){
      		toastr.success('文件上传成功！');
      		//$("#viewFiles").attr('href','http://localhost:8000//attachment//samplekeep'+res);
	      	$("#remark01").val(res);
      	}else{
      		toastr.warning('图片上传失败！');
      	}
      }
    });
	//多文件上传
    upload.render({
      elem: '#fileNeg'
      ,url: '${pageContext.request.contextPath}/upload/picUpload.do'
      ,multiple: true
      //允许上传的文件类型
      ,exts: 'jpg|png|gif|jpeg|PNG|zip|rar|txt|doc|docx|xls|xlsx|ppt|pptx|mp3|mp4|avi|flv|rm|rmvb|'
      /* ,before: function(obj){
        //预读本地文件示例，不支持ie8
		obj.preview(function(index, file, result){
          	$('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
        });
      } */
      ,done: function(res){
        //上传完毕
   	  if(res != "" && res != null){
      		toastr.success('文件上传成功！');
      		//$("#viewFiles").attr('href','http://localhost:8000//attachment//samplekeep'+res);
	      	$("#remark04").val(res);
      	}else{
      		toastr.warning('图片上传失败！');
      	}
      }
    });
	$("#cancel").click(function(){
		layer.closeAll();
	})
})
toastr.options.positionClass = 'toast-top-center'; //提示框的位置设置为中上
</script>
</body>
</html>